package com.hq.ims.userpc.controller;

import com.hq.ims.data.annotation.UserOperationMonitor;
import com.hq.ims.data.utils.LocalConstant;
import com.hq.ims.data.vo.BusInfoForewarningMapstruct;
import com.hq.ims.userpc.busservice.UserBusiInfoForewarningService;
import com.hq.mybatis.base.page.RequestPage;
import com.hq.mybatis.base.page.ReturnPage;
import com.hq.utils.vo.ReturnVo;
import com.hq.web.annotations.GetJsonValue;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author cx
 * @date 2024/11/26 11:21:02
 * @description 经营信息预警Controller
 */
@Api(tags = "经营信息预警")
@RestController
@RequestMapping(LocalConstant.SYS_TYPE_USER_PC_URL_PREFIX + "/busiInfoForewarning")
public class UserBusiInfoForewarningController {

    @Resource
    private UserBusiInfoForewarningService userBusiInfoForewarningService;

    @ApiOperation(value = "经营信息预警列表查询", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/pageList", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<ReturnPage<BusInfoForewarningMapstruct.BusInfoForewarningVo>> pageList(
            @RequestBody RequestPage<BusInfoForewarningMapstruct.BusInfoForewarningVo> page,
            @RequestBody BusInfoForewarningMapstruct.PageSearchVo searchVo) {
        return userBusiInfoForewarningService.pageList(page, searchVo);
    }

    @ApiOperation(value = "未接收预警详情", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/getNotReceiveDetail", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<BusInfoForewarningMapstruct.NotReceiveDetailVo> getNotReceiveDetail(@GetJsonValue(zh = "预警id") String busInfoForewarningId) {
        return userBusiInfoForewarningService.getNotReceiveDetail(busInfoForewarningId);
    }

    @ApiOperation(value = "未反馈预警详情", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/getNotFeedbackDetail", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<BusInfoForewarningMapstruct.NotFeedbackDetailVo> getNotFeedbackDetail(@GetJsonValue(zh = "预警id") String busInfoForewarningId) {
        return userBusiInfoForewarningService.getNotFeedbackDetail(busInfoForewarningId);
    }

    @UserOperationMonitor
    @ApiOperation(value = "发送预警短信", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/sendForewarningSms", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<Boolean> sendForewarningSms(@RequestBody @Valid BusInfoForewarningMapstruct.ForewarningSmsVo forewarningSmsVo) {
        return userBusiInfoForewarningService.sendForewarningSms(forewarningSmsVo);
    }
}
